<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        section {
            width: 400px;
            height: 400px;
            border: 1px solid red;
            margin: 150px auto;
            text-align: center;
        }

        div {
            width: 350px;
            height: 80px;
            margin-top: 150px;
            margin-left: 30px;
        }

        section div .left {
            width: 50px;
            height: 30px;
        }

        section div .right {
            width: 50px;
            height: 30px;
        }

        section button {
            width: 100px;
            height: 40px;
        }
    </style>
</head>

<body>
    <section>
        <div>
            <input type="text" name="" value="1" class="left">分
            <input type="text" name="" value="10" class="right">秒
        </div>

        <button type="button">开始</button>

    </section>
</body>

</html>
<script>
    var left = document.querySelector('.left');
    var right = document.querySelector('.right');
    var button = document.querySelector('button');
    var aa = Number(left.value);
    var ss = Number(right.value);
    var timer;
    var t;
    var tt;

    function ready() {

        if (ss > 0 && ss <= 60) {
            ss = ss - 1;
            if (ss < 10) {
                right.value = "0" + ss;
            }
            else {
                right.value = ss;
            }
        }

    }
    function ww() {
        if (aa > 0 && ss == 0) {
            aa = aa - 1;
            ss = 59;
            left.value = aa
            right.value = ss
            tt = setInterval(ready, 1000);

        }
    }
    var isclick = false;
    button.onclick = function () {
        if (isclick){
            clearInterval(t);
            clearInterval(timer);
             clearInterval(tt);

            isclick=false;
            button.innerHTML='开始';
        }
        else {
            t = setInterval(ready, 1000);
            timer = setInterval(ww, 1000);
            isclick=true;
            button.innerHTML='结束';
        
        }

    }

</script>